﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Admin.Core.Common.Input;
using Admin.Core.Common.Output;
using Admin.Core.Common.ParamInput;
using Admin.Core.Service.Warehouse.StockList;
using Admin.Core.Service.Warehouse.StockList.Output;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Admin.Core.Controllers.Warehouse
{
    public class StockListController : AreaController
    {

        private readonly IStockListService _stockListService;

        public StockListController(IStockListService stockListService)
        {
            _stockListService = stockListService;
        }

        /// <summary>
        /// 分页查询库位信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> GetPage(PageInput<StockInCkFilterInput> model)
        {
            return await _stockListService.PageAsync(model);
        }

        /// <summary>
        /// 导出全部信息
        /// </summary>
        /// <param name="name"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<StockListOutput>> ExportAllPage(string name, long? id)
        {
            return await _stockListService.GetAllPageAsync(name, id);
        }


        /// <summary>
        /// 分页查询库位信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> GetDetailPage(PageInput<StockInDetailFilterInput> model)
        {
            return await _stockListService.PageDetailAsync(model);
        }

        /// <summary>
        /// 导出全部信息
        /// </summary>
        /// <param name="wlId"></param>
        /// <param name="kwId"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<StockListDetailOutput>> ExportAllDetailPage(long? wlId, long? kwId)
        {
            return await _stockListService.GetAllDetailPageAsync(wlId, kwId);
        }
    }
}